const express = require('express');
const router = express.Router();
const authMiddleware = require('../middlewares/authMiddleware');
const healthKnowledgeController = require('../controllers/healthKnowledgeController');

// 需要身份验证的路由
router.use(authMiddleware);

// 获取文章列表
router.get('/articles', healthKnowledgeController.getArticles);

// 获取单篇文章详情
router.get('/articles/:id', healthKnowledgeController.getArticleById);

// 点赞文章
router.post('/articles/:id/like', healthKnowledgeController.likeArticle);

// 添加示例文章（仅用于开发测试）
router.post('/sample-articles', healthKnowledgeController.addSampleArticles);

module.exports = router; 